package com.thoughtworks.shoutbox.server.models;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Shout {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String id;

	@Persistent
	private String message;
	@Persistent
	private UserDetails user;
	
	@Persistent
	private String roomId;

	public Shout(String message, UserDetails userDetails, String roomId) {
		this.message = message;
		this.user = userDetails;
		this.roomId = roomId;
	}

	public String getMessage() {
		return message;
	}

	public UserDetails getUser() {
		return user;
	}

	@SuppressWarnings("unused")
	private Shout() {
	}
}
